/**
 * @file RoboPID.h
 * @author Zifeng Huang (Mitcher2022@outlook.com)
 * @brief PID Controller, Cascade Control, Fuzzy Control and more
 * @version 0.1
 * @date 2022-10-28
 * 
 * @copyright Copyright (c) 2022
 * 
 */
#ifndef ROBOPID_H_
#define ROBOPID_H_
#include <cmath>
namespace RoboPid
{
    class PID{
	private:
		double targetVal;
		double ek0, ek1, ek2; //分别对应于增量式PID公式中的ek0,ek-1,ek-2
		double Kp, Ki, Kd;
		double MaxOutput, MinOutput;
	public:
		double Output;
		PID(double _Kp, double _Ki, double _Kd, double Max, double Min, double _targetVal = 0); //double _Kp = 0, double _Ti = 0, double _Td = 0
		void SetTarget(double _targetVal = 0);
		double Controller(double CurrentVal);
	};
}
#endif